package com.huang.auth.converter;


import com.huang.auth.entity.po.AuthResourcePO;
import com.huang.auth.entity.vo.AuthResourceSimpleVO;
import com.huang.base.core.BaseConvertor;
import org.springframework.stereotype.Component;

import java.util.Objects;

@Component
public class AuthResourceSimpleVOConverter extends BaseConvertor<AuthResourcePO,AuthResourceSimpleVO> {


    @Override
    public AuthResourceSimpleVO doConvert(AuthResourcePO m) {
        AuthResourceSimpleVO authResourceSimpleVO = new AuthResourceSimpleVO();
        authResourceSimpleVO.setCode(m.getCode());
        authResourceSimpleVO.setName(m.getName());
        authResourceSimpleVO.setId(m.getId().toString());
        authResourceSimpleVO.setDescribe(m.getDescribe());
        if (!Objects.isNull(m.getMenuId())){
            authResourceSimpleVO.setMenuId(m.getMenuId().toString());
        }
        return authResourceSimpleVO;
    }
}
